//GEN-FIRST:event_manageProduct2StoreMenuItemActionPerformed
/*//GEN-LAST:event_manageProduct2StoreMenuItemActionPerformed
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
 */
package supermarketgui;

//~--- non-JDK imports --------------------------------------------------------

import supermarketgui.utils.CloseListener;
import supermarketgui.utils.ExitAction;
import supermarketgui.utils.StatusBar;

//~--- JDK imports ------------------------------------------------------------

import java.awt.Cursor;
import java.awt.Dimension;

import java.text.SimpleDateFormat;

import java.util.Calendar;


/**
 *
 * @author JK
 */
public class SuperMarketMDI extends javax.swing.JFrame {

    // Variables declaration - do not modify
    private javax.swing.JMenu                aboutMenu;
    private javax.swing.JMenuItem            aboutMenuItem;
    private javax.swing.JToolBar             administartorToolBar;
    private javax.swing.JMenu                administratorMenu;
    private javax.swing.JMenuItem            changePasswordCustomerMenuItem;
    private javax.swing.JMenuItem            checkCustomerMenuItem;
    private javax.swing.JButton              customerButton;
    private javax.swing.JMenu                customerProductMarketMenu;
    private javax.swing.JMenu                customerProfilMenu;

    /**
     *
     */
    public javax.swing.JDesktopPane          desktopPane;
    private javax.swing.JMenuItem            editCustomerProfilMenuItem;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JMenuItem            manageCustomerMenuItem;
    private javax.swing.JMenuItem            manageProduct2StoreMenuItem;
    private javax.swing.JMenuItem            manageProductMenuItem;
    private javax.swing.JMenuItem            manageStoreMenuItem;
    private javax.swing.JMenuBar             menuBar;
    private javax.swing.JButton              product2SupermarketButton;
    private javax.swing.JButton              productButton;
    private javax.swing.JMenuItem            productMarketMenuItem;
    private javax.swing.JButton              superamkertButton;
    private javax.swing.JMenuItem            viewProductMarketMenuItem;

    // End of variables declaration

    /*
     * Creates new form TestMDI
     */

    /**
     *
     */
    
    public SuperMarketMDI() {
        initComponents();
        administratorMenu.add(new ExitAction());

        CloseListener cl = new CloseListener("Θέλετε να κλείσετε την εφαρμογή;", "Έξοδος");

        addWindowListener(cl);

        Calendar         currentDate = Calendar.getInstance();
        SimpleDateFormat formatter   = new SimpleDateFormat("dd/MM/yyyy");
        String           dateNow     = formatter.format(currentDate.getTime());
        StatusBar        statusBar   = new StatusBar();

        getContentPane().add(statusBar, java.awt.BorderLayout.SOUTH);
        statusBar.setMessage("ΠΛΗ24-ΠΑΤ1-ΕΡΓΑΣΙΑ 3 | " + dateNow);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")

    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
        desktopPane                    = new javax.swing.JDesktopPane();
        administartorToolBar           = new javax.swing.JToolBar();
        superamkertButton              = new javax.swing.JButton();
        productButton                  = new javax.swing.JButton();
        customerButton                 = new javax.swing.JButton();
        product2SupermarketButton      = new javax.swing.JButton();
        menuBar                        = new javax.swing.JMenuBar();
        administratorMenu              = new javax.swing.JMenu();
        manageStoreMenuItem            = new javax.swing.JMenuItem();
        manageProductMenuItem          = new javax.swing.JMenuItem();
        manageCustomerMenuItem         = new javax.swing.JMenuItem();
        manageProduct2StoreMenuItem    = new javax.swing.JMenuItem();
        jSeparator1                    = new javax.swing.JPopupMenu.Separator();
        customerProfilMenu             = new javax.swing.JMenu();
        editCustomerProfilMenuItem     = new javax.swing.JMenuItem();
        changePasswordCustomerMenuItem = new javax.swing.JMenuItem();
        checkCustomerMenuItem          = new javax.swing.JMenuItem();
        customerProductMarketMenu      = new javax.swing.JMenu();
        productMarketMenuItem          = new javax.swing.JMenuItem();
        viewProductMarketMenuItem      = new javax.swing.JMenuItem();
        aboutMenu                      = new javax.swing.JMenu();
        aboutMenuItem                  = new javax.swing.JMenuItem();
        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        desktopPane.setBackground(new java.awt.Color(204, 204, 204));
        desktopPane.setLayout(new java.awt.BorderLayout());
        administartorToolBar.setRollover(true);
        superamkertButton.setText("Καταστήματα");
        superamkertButton.setToolTipText("Διαχείριση καταστημάτων (Δημιουργία, Τροποποίηση, Διαγραφή)");
        superamkertButton.setFocusable(false);
        superamkertButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        superamkertButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        administartorToolBar.add(superamkertButton);
        productButton.setText("Προϊόντα");
        productButton.setToolTipText("Διαχείριση προϊόντων (Δημιουργία, Τροποποίηση, Διαγραφή)");
        productButton.setFocusable(false);
        productButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        productButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        administartorToolBar.add(productButton);
        customerButton.setText("Πελάτες");
        customerButton.setFocusable(false);
        customerButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        customerButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        administartorToolBar.add(customerButton);
        product2SupermarketButton.setText("Προϊόντα σε Καταστήματα");
        product2SupermarketButton.setFocusable(false);
        product2SupermarketButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        product2SupermarketButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        administartorToolBar.add(product2SupermarketButton);
        desktopPane.add(administartorToolBar, java.awt.BorderLayout.PAGE_START);
        getContentPane().add(desktopPane, java.awt.BorderLayout.CENTER);
        administratorMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/supermarketgui/icons/administrator.png")));    // NOI18N
        administratorMenu.setMnemonic('\u0394');
        administratorMenu.setText("Διαχειριστής");
        administratorMenu.setToolTipText("Λειτουργίες διαχείρισης εφαρμογής");
        manageStoreMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/supermarketgui/icons/supermarket.jpg")));    // NOI18N
        manageStoreMenuItem.setMnemonic('\u039a');
        manageStoreMenuItem.setText("Διαχείριση καταστημάτων");
        manageStoreMenuItem.setToolTipText("Δημιουργία, Τροποποίηση και Διαγραφή Καταστήματος");
        manageStoreMenuItem.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                manageStoreMenuItemActionPerformed(evt);
            }
        });
        administratorMenu.add(manageStoreMenuItem);
        manageProductMenuItem.setMnemonic('\u03c0');
        manageProductMenuItem.setText("Διαχείριση προϊόντων");
        manageProductMenuItem.setToolTipText("Δημιουργία, Τροποίηση και Διαγραφή Προϊόντος");
        manageProductMenuItem.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                manageProductMenuItemActionPerformed(evt);
            }
        });
        administratorMenu.add(manageProductMenuItem);
        manageCustomerMenuItem.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/supermarketgui/icons/customers.png")));    // NOI18N
        manageCustomerMenuItem.setMnemonic('\u03bb');
        manageCustomerMenuItem.setText("Διαχείριση προφίλ πελατών");
        manageCustomerMenuItem.setToolTipText("Δημιουργία, Τροποποίηση και Διαγραφή Πελάτη");
        administratorMenu.add(manageCustomerMenuItem);
        manageProduct2StoreMenuItem.setMnemonic('\u03a3');
        manageProduct2StoreMenuItem.setText("Συσχέτιση προϊόντων και καταστημάτων");
        manageProduct2StoreMenuItem.setToolTipText("Σύνδεση Προϊόντων με Καταστήματα");
        manageProduct2StoreMenuItem.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                manageProduct2StoreMenuItemActionPerformed(evt);
            }
        });
        administratorMenu.add(manageProduct2StoreMenuItem);
        administratorMenu.add(jSeparator1);
        menuBar.add(administratorMenu);
        customerProfilMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/supermarketgui/icons/customers.png")));    // NOI18N
        customerProfilMenu.setMnemonic('\u03a0');
        customerProfilMenu.setText("Διαχείριση Προφίλ");
        editCustomerProfilMenuItem.setMnemonic('\u0395');
        editCustomerProfilMenuItem.setText("Επεξεργασία προφίλ");
        customerProfilMenu.add(editCustomerProfilMenuItem);
        changePasswordCustomerMenuItem.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/supermarketgui/icons/key1.png")));    // NOI18N
        changePasswordCustomerMenuItem.setMnemonic('\u0391');
        changePasswordCustomerMenuItem.setText("Αλλαγή κωδικού");
        customerProfilMenu.add(changePasswordCustomerMenuItem);
        checkCustomerMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/supermarketgui/icons/cheque0.png")));    // NOI18N
        checkCustomerMenuItem.setMnemonic('\u03c4');
        checkCustomerMenuItem.setText("Επιταγές");
        customerProfilMenu.add(checkCustomerMenuItem);
        menuBar.add(customerProfilMenu);
        customerProductMarketMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/supermarketgui/icons/buy.png")));    // NOI18N
        customerProductMarketMenu.setMnemonic('\u03a0');
        customerProductMarketMenu.setText("Αγορά");
        productMarketMenuItem.setMnemonic('\u03a0');
        productMarketMenuItem.setText("Πραγματοποίηση αγορών");
        customerProductMarketMenu.add(productMarketMenuItem);
        viewProductMarketMenuItem.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/supermarketgui/icons/basket.png")));    // NOI18N
        viewProductMarketMenuItem.setMnemonic('\u03ba');
        viewProductMarketMenuItem.setText("Προβολή καλαθιού");
        customerProductMarketMenu.add(viewProductMarketMenuItem);
        menuBar.add(customerProductMarketMenu);
        aboutMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/supermarketgui/icons/info.png")));    // NOI18N
        aboutMenu.setMnemonic('\u03a4');
        aboutMenu.setText("Ταυτότητα");
        aboutMenuItem.setMnemonic('\u0395');
        aboutMenuItem.setText("Εφαρμογής");
        aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutMenuItemActionPerformed(evt);
            }
        });
        aboutMenu.add(aboutMenuItem);
        menuBar.add(aboutMenu);
        setJMenuBar(menuBar);
        pack();
    }    // </editor-fold>

    private void manageProduct2StoreMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
        System.exit(0);
    }

    private void manageStoreMenuItemActionPerformed(java.awt.event.ActionEvent evt) {

        // TODO add your handling code here:
    }

    private void manageProductMenuItemActionPerformed(java.awt.event.ActionEvent evt) {

        // TODO add your handling code here:
        this.setCursor(Cursor.WAIT_CURSOR);

        ProductFrame prdForm = new ProductFrame();

        prdForm.setTitle("Κατάλογος Προϊόντων");
        prdForm.setVisible(true);
        prdForm.setResizable(true);
        prdForm.setClosable(true);
        prdForm.setMaximizable(true);
        prdForm.setIconifiable(true);

        Dimension desktopSize      = this.getSize();
        Dimension prdFormFrameSize = prdForm.getSize();

        prdForm.setLocation((desktopSize.width - prdFormFrameSize.width) / 2,
                            (desktopSize.height - prdFormFrameSize.height) / 2);
        desktopPane.add(prdForm);
        this.setCursor(Cursor.DEFAULT_CURSOR);
    }

    private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {

        // TODO add your handling code here:
        About about = new About(null, true);

        about.setResizable(false);
        about.setLocationRelativeTo(null);
        about.setVisible(true);
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {

        /* Set the Nimbus look and feel */

        // <editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

        /*
         *  If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());

                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(SuperMarketMDI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }

        // </editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new SuperMarketMDI().setVisible(true);
            }
        });
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
